package com.demo.supplier.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 用户实体类
 * 
 * @author demo
 */
@Data
@TableName("T_SYS_USER")
@ApiModel("用户实体")
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("用户ID")
    @TableId(value = "ID", type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty("用户名")
    @TableField("USERNAME")
    private String username;

    @ApiModelProperty("密码")
    @TableField("PASSWORD")
    private String password;

    @ApiModelProperty("真实姓名")
    @TableField("REAL_NAME")
    private String realName;

    @ApiModelProperty("邮箱")
    @TableField("EMAIL")
    private String email;

    @ApiModelProperty("手机号")
    @TableField("PHONE")
    private String phone;

    @ApiModelProperty("状态：1=启用，0=禁用")
    @TableField("STATUS")
    private Integer status;

    @ApiModelProperty("头像文件ID")
    @TableField("AVATAR_FILE_ID")
    private Long avatarFileId;

    // 非数据库字段，用于返回头像文件信息
    @TableField(exist = false)
    private FileInfo avatarFile;

    @ApiModelProperty("创建时间")
    @TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "UPDATE_TIME", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @ApiModelProperty("创建人")
    @TableField(value = "CREATE_BY", fill = FieldFill.INSERT)
    private Long createBy;

    @ApiModelProperty("更新人")
    @TableField(value = "UPDATE_BY", fill = FieldFill.INSERT_UPDATE)
    private Long updateBy;

    @ApiModelProperty("删除标记：1=已删除，0=未删除")
    @TableField("DELETED")
    @TableLogic
    private Integer deleted;
}